﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace AiQiuQuan.Sport.Core.WechatApi
{
    /// <summary>
    /// 微信API扩展
    /// </summary>
    public static class WechatApiExtensions
    {
        /// <summary>
        /// 添加微信API服务
        /// </summary>
        /// <param name="services">IServiceCollection</param>
        /// <param name="wechatApiOptionConfiguration">WechatApiOption IConfiguration</param>
        /// <returns></returns>
        public static IServiceCollection AddWechatApi(this IServiceCollection services, IConfiguration wechatApiOptionConfiguration)
        {
            services.Configure<WechatApiOption>(wechatApiOptionConfiguration);
            //注入api clientfactory
            services.AddSingleton<IWechatApiHttpClientFactory, WechatApiHttpClientFactory>();
            return services;
        }
    }
}
